1. Field of the Invention
The present invention relates to a method of measuring a period of a pulse in which noise such as chattering may occur in the pulse end sections.
2. Description of the Related Art
The speed of a motor can be controlled by obtaining from a motor module a pulse signal PI in which the period varies in accordance with the rotational speed ω of the motor. A motor speed controller measures the period of the pulses appearing in the pulse signal, detects the rotational speed ω of the motor from that period, and drives the motor so that the rotational speed ω is brought to a target value.
Chattering may occur at the edges (pulse ends) of this pulse signal, that is, at the timing when the signal switches from Low level (L level) to High level (H level) or from H level to L level. Such chattering and other noise become an error factor in the measurement of the pulse period. In response to this problem, attempts have hitherto been made to reduce the effect of chattering when detecting pulse edges and to improve the precision of measurement of the pulse period.
FIG. 7 is a signal waveform chart illustrating a conventional pulse period measurement method. In FIG. 7, the horizontal axis is the time axis, and a plurality of signals CLK, PI, rPI, LE, NP, and C are arrayed vertically, with their respective time axes in alignment. The pulse signal PI input from the motor module is sampled, for example, at the timing of the rise of a reference clock CLK. If the sampled value changes and then remains the same value consecutively over a designated number of times nD, (in FIG. 7 nD=2), a determination is made that the timing is the pulse edge. From the pulse signal rPI for which the pulse edge was thus established, the chattering 4 appearing on the leading and trailing edges of the pulse 2 of the pulse signal PI can be eliminated. The pulse 6 appearing in the pulse signal rPI is sampled at the timing of the rise of the clock signal CLK, and when, for example, the sampled signal level changes from L to H, an edge detection pulse 8 is generated in the detection signal LE of the rise of the pulse 6. The period of the pulse 8 is measured by the count value NP of a counter for counting up values in synchronization with the clock signal CLK. That is, the count value NP at the fall time (times Ta and Tb) of the pulse 8 is latched and output as a period count value of the pulse signal PI, the count value NP is reset at that fall, and counting up to measure the next period is started.